package com.action.ui.activity.user;

import android.widget.FrameLayout;

import com.action.childbase.ChildBaseActivity;
import com.action.entity.event.SwitchAssetEvent;
import com.action.ui.fragment.UserFrament;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.base.app_core.service.pressenter.NullPressenter;
import com.base.app_core.util.AppConstants;
import com.xinglai.yun.R;
import com.hwangjr.rxbus.RxBus;
import com.hwangjr.rxbus.annotation.Subscribe;
import com.hwangjr.rxbus.thread.EventThread;

import butterknife.BindView;

@Route(path = AppConstants.ROUTEURI.USER_DETAIL)
public class UserActivity extends ChildBaseActivity<NullPressenter> {

    @BindView(R.id.container)
    FrameLayout frameLayout;

    @Subscribe(thread = EventThread.MAIN_THREAD)
    public void consumeSwitchAssetEvent(SwitchAssetEvent switchAssetEvent) {
        userFrament = null;
        UserActivity.this.finish();
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_member;
    }

    private UserFrament userFrament = null;

    @Override
    protected void initView() {
        super.initView();
        userFrament = new UserFrament();
        getSupportFragmentManager().beginTransaction().add(R.id.container, userFrament, "memberfragment").commit();
        RxBus.get().register(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        RxBus.get().unregister(this);
    }
}
